package com.icss.controller;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.icss.dao.ItemDao;
import com.icss.entity.Item;
import com.icss.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class ItemController {
    @Autowired
    private ItemDao itemDao;
    @RequestMapping("showitem")
    @JsonBackReference
    public ResponseEntity<List<Item>> showUser(){
        List<Item> items = itemDao.findAll();
        for (Object objects : items) {
            System.out.println(objects.toString());
        }
        return new ResponseEntity<List<Item>>(items, HttpStatus.OK);
    }
}
